{% extends "layout.html" %}
{% block content %}

<div class="layui-row">
    <div class="layui-btn-container">
        <button type="button" class="layui-btn layui-btn-normal" id="QuickFileUpload">选择文件</button>
        <button type="button" class="layui-btn" id="QuickFileUploadBtn">开始上传</button>
    </div>
</div>
<hr>
<div class="layui-row">
    <a href="/depart/add/" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe654;</i>新建部门</a>
</div>
<div class="layui-row">
    <table class="layui-table">
        <colgroup>
            <col width="100">
            <col>
            <col>
        </colgroup>
        <thead>
        <tr>
            <th>ID</th>
            <th>名称</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for item in data_list %}
        <tr>

            <td>{{item.id}}</td>
            <td>{{item.title}}</td>
            <td>
                <a href="/depart/{{item.id}}/edit/" class="layui-btn layui-btn-sm ">编辑</a>
                <a href="/depart/delete/?depart_id={{item.id}}" class="layui-btn layui-btn-sm layui-btn-danger"
                   target="_blank">删除</a>
            </td>
        </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}
{% block js %}
<script>
    layui.use(function () {
        var upload = layui.upload;
        // 渲染
        upload.render({
            elem: '#QuickFileUpload',
            url: '/depart/multi/', // 此处配置你自己的上传接口即可
            field:'files',
            auto: false,
            accept:'file',
            // multiple: true,
            bindAction: '#QuickFileUploadBtn',
            done: function (res) {
                layer.msg('上传成功');
                console.log(res)
            }
        });
    });
</script>
{% endblock %}